import { IAccountParams } from '../interface/account';
import * as request from './request';

export async function getAllAccount(body: IAccountParams) {
  try {
    const login = sessionStorage.getItem('login')?.toString();
    if (login === '1') {
      const data = await request.post(
        JSON.stringify(body),
        '/api/console/account/get',
      );
      return data;
    } else {
      return {};
    }
  } catch (e) {
    return e;
  }
}

export async function whiteList(body: { id: string }) {
  try {
    const data = await request.post(
      JSON.stringify(body),
      '/api/console/account/whiteList',
    );
    return data;
  } catch (e) {
    return e;
  }
}

export async function froozen(body: { id: string }) {
  try {
    const data = await request.post(
      JSON.stringify(body),
      '/api/console/account/froozen',
    );
    return data;
  } catch (e) {
    return e;
  }
}

export async function createNewAccount(body: {
  account: string;
  nickname: string;
  password: string;
}) {
  try {
    const data = await request.post(
      JSON.stringify(body),
      '/api/console/account/add',
    );
    return data;
  } catch (e) {
    return e;
  }
}

// export async function getUser(body: { userId: string }) {
//   try {
//     const data = await request.post(JSON.stringify(body), '/api/console/account/getUser')
//     return data
//   } catch (e) {
//     return (e)
//   }
// }

// export async function getFocuseInfo(body: { focus: string[] }) {
//   try {
//     const data = await request.post(JSON.stringify(body), '/api/console/account/getFocusUser')
//     return data
//   } catch (e) {
//     return (e)
//   }
// }

// export async function resetPasswordHandle(body: ResetPasswordInfo) {
//   try {
//     const data = await request.post(JSON.stringify(body), '/api/console/account/resetPassword')
//     return data
//   } catch (e) {
//     return (e)
//   }
// }

// export async function changeAvatarHandle(body: IChangeAvatar) {
//   try {
//     const data = await request.post(JSON.stringify(body), '/api/console/account/changeAvatar')
//     return data
//   } catch (e) {
//     return (e)
//   }
// }

// export async function logOutHandle(token: string) {
//   try {
//     const data = await request.post('', '/api/console/account/logout', token)
//     return data
//   } catch (e) {
//     return (e)
//   }
// }

// export async function changeAccount(body: ChangeAccount) {
//   try {
//     const data = await request.post(JSON.stringify(body), '/api/console/account/change')
//     return data
//   } catch (e) {
//     return (e)
//   }
// }
